package com.liu.backstage.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.liu.backstage.model.User;
import com.liu.backstage.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.management.modelmbean.ModelMBean;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 腾杰说
 * @since 2020-07-08
 */
@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/findAll")
    public String findAll(){
        return "Userlist";
    }

    @RequestMapping("/getData")
    public String getData(Model model){
        List<User> list = userService.list();
        model.addAttribute("Userlist",list);

        return "UserData";
    }
}

